let fs = require("fs");

fs.writeFileSync("./demo.txt","this is demo");

fs.writeFile("./demo02.txt","this is demo02", function() {
    console.log(arguments);
});

let data = fs.readFileSync('./demo.txt',{encoding:'utf8', flag:'r'});
console.log(data);  //this is demo


fs.readFile('./demo.txt',{encoding:'utf8'},function(err,data){
    //console.log(data);
})

let stream = fs.createReadStream('./demo.txt',{encoding:'utf8',highWaterMark:2});     //highWaterMark: 从第n个开始，每次读取n个

stream.on('data',function(chunk){//chunk 默认大小？
   console.log(chunk+'=======================')
});